UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhnrKRtsumpakCRsi+uphKqjTz699M30/EsshihITpQ=' 
WHERE 
  key_id = 'b6cdc9ad8ecdcab3252fec67c180f153c21a203c9f5708075d056ddb94d57053' 
  AND (
    token = 'yhnrKRtsumpakCRsi+uphKqjTz699M30/EsshihITpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046