UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2edXGC8L4P2x3CtzLrj4Qx395Q7lswxCO9MqHmLoq68=' 
WHERE 
  key_id = '058dfa2d4e7330dfd0737b847267e68f1ab091ad613ce8ddc53ec048e2bd0921' 
  AND (
    token = '2edXGC8L4P2x3CtzLrj4Qx395Q7lswxCO9MqHmLoq68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028