UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hCSbVXyQWTRk5jODCRqYK0BgTBQutF7I+ugy+OnJSbI=' 
WHERE 
  key_id = '55885be424ac0f661e970c9e48866384355adc54d7a3277cb83cb0cde8531335' 
  AND (
    token = 'hCSbVXyQWTRk5jODCRqYK0BgTBQutF7I+ugy+OnJSbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034