UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpzloKV4zxsrE7RD49X2Q50e00rGS20B97DNPA86dh4=' 
WHERE 
  key_id = '57e9b83fe7c48019181d21df32593bb0e3327f3415fe90abbb5665fa37f43f3e' 
  AND (
    token = 'hpzloKV4zxsrE7RD49X2Q50e00rGS20B97DNPA86dh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028