UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gE2brZajpzzBoP4E5/DwkocD6FtxjRm4K5mg5aKQI1I=' 
WHERE 
  key_id = 'a71e2a84c01dc2b2aca8fffc148e5bba399490189308e91f2688abf766b866b6' 
  AND (
    token = 'gE2brZajpzzBoP4E5/DwkocD6FtxjRm4K5mg5aKQI1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036