UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NwL//yAmiA5AV1Q0ABs13pP+crFosw85lYIUrrkf14s=' 
WHERE 
  key_id = 'c644d564c215c0f1d5bddb0f34c856b357aae8d9739f377c4bca083cc50f43cf' 
  AND (
    token = 'NwL//yAmiA5AV1Q0ABs13pP+crFosw85lYIUrrkf14s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019