UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fE0WbWhqpknfe8i6VkH+2TDzS5emAgRiXZ4M/q2NsVk=' 
WHERE 
  key_id = '417abf8f908248115dc3f9bbd7119caa798093e92191c94445ee653022e031bf' 
  AND (
    token = 'fE0WbWhqpknfe8i6VkH+2TDzS5emAgRiXZ4M/q2NsVk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017