UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GrN6m1qhjpYfoaGBRm1MYGEcO38b05NhFaoFqb9Ysd0=' 
WHERE 
  key_id = 'f76b378db10490f1530209f38ad1c2db031de1c5f68f855d5b2d8b995566a944' 
  AND (
    token = 'GrN6m1qhjpYfoaGBRm1MYGEcO38b05NhFaoFqb9Ysd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028