UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UvyUtmDul1ykZJhhWeJ5YbaDplsZPqwP2+mH/FsjH3s=' 
WHERE 
  key_id = '40daa9b587b79c854caada4908af79d75b108754f9877a7d009cba86a406a6b1' 
  AND (
    token = 'UvyUtmDul1ykZJhhWeJ5YbaDplsZPqwP2+mH/FsjH3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015