UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k26+/LkcggoLUq+RbnRoxpKpU6NfRmMN0/3fHjbOk+A=' 
WHERE 
  key_id = 'f9ed07b0d2a76a5431732c9972227878947df5f3f4aab74e0045d7500a5552de' 
  AND (
    token = 'k26+/LkcggoLUq+RbnRoxpKpU6NfRmMN0/3fHjbOk+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022