UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qcNji/IayuAQMrZK46L200wR2yqvmXGx+noP0W+Vuxs=' 
WHERE 
  key_id = '4d35fd3f6fbe2614d2470830b86540b319fde12b8c9436a96fff810bd37e43a5' 
  AND (
    token = 'qcNji/IayuAQMrZK46L200wR2yqvmXGx+noP0W+Vuxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077