UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qkCuRI+jhJS8xETXI1n11d6F5x2ZCW0ZQRQNYe5+jic=' 
WHERE 
  key_id = '977657cdded2fa3b3988b9b8765cdd4a29960291c88d43c364ce6733573015fa' 
  AND (
    token = 'qkCuRI+jhJS8xETXI1n11d6F5x2ZCW0ZQRQNYe5+jic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041