UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UqH+6rMCD20IA4bDz+TeXHJEFqc/bMQao6bBQnSgBd4=' 
WHERE 
  key_id = 'f2f733fa9bf5fdfecc7df54a963797fe821387644b6048ba78802f3388a47805' 
  AND (
    token = 'UqH+6rMCD20IA4bDz+TeXHJEFqc/bMQao6bBQnSgBd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034