UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'llhLU5q/o/YGgAxS4N0oZ8uKCHHwKC67I8IAjWH8hoM=' 
WHERE 
  key_id = '4867b269bb8ce0cc8c3fa7a4b053027efb520c58c598de6c1d8223b6d9efacab' 
  AND (
    token = 'llhLU5q/o/YGgAxS4N0oZ8uKCHHwKC67I8IAjWH8hoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032