UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ve2LU2TrLFYSvkXxWlOmF6t4+htypyxlokI+r5SmxLc=' 
WHERE 
  key_id = 'c024a030fc48a2229995ef340f8d02939da34ff6891059194203089e8985590d' 
  AND (
    token = 'Ve2LU2TrLFYSvkXxWlOmF6t4+htypyxlokI+r5SmxLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066