UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PldiqvhGYNpmrhGQknHVU1H/AlQbjI7ZisNeBa3hjFA=' 
WHERE 
  key_id = '524c8503835df197a8ae12988ce7930bd0c8b705b95bd840abcd20302e0d361a' 
  AND (
    token = 'PldiqvhGYNpmrhGQknHVU1H/AlQbjI7ZisNeBa3hjFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029