UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'exZMh+4G5CpIAT6QF/MaDPEm36K0VgzFu3aTRX7CQ8Q=' 
WHERE 
  key_id = '64b2955f333d92a56f80ce2bf56e1a145c39545f0d74ea8b4412bec108a2ff7a' 
  AND (
    token = 'exZMh+4G5CpIAT6QF/MaDPEm36K0VgzFu3aTRX7CQ8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040