UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iU6fvnSWbyjphE8DJson5leH3hSo6fDHCrrbxzo+KLw=' 
WHERE 
  key_id = '35a6f4eb937d89caaa1a42d5b0798fc7792e53fe9a96c1bad52600bb2a27ad22' 
  AND (
    token = 'iU6fvnSWbyjphE8DJson5leH3hSo6fDHCrrbxzo+KLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037