UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'apyA5TqCSHq8wuH0pn/Hox+l+zZwsu11hVmZsJS5Akw=' 
WHERE 
  key_id = '8a9fe4d18423e0ccf74cb3db2d9d8dae3f2704fa3941332c8956b28263da7106' 
  AND (
    token = 'apyA5TqCSHq8wuH0pn/Hox+l+zZwsu11hVmZsJS5Akw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032