UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ip68Pb3TTfaS/VntOkwpbzCBgvElcINc8M+sX4pns7Q=' 
WHERE 
  key_id = 'a40cda04dae2993d1a037b7d7ffe07531f95320661bc9259f12405345a6f9dac' 
  AND (
    token = 'Ip68Pb3TTfaS/VntOkwpbzCBgvElcINc8M+sX4pns7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051