UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+EeFc/1G1r9Z1NBL+9uVVf+0Q+02xc1T9eDsEkHyNY=' 
WHERE 
  key_id = 'd7bb575ad349838696ab466fcdee13bd9782fcdd1d20e25100ec72fef67d2502' 
  AND (
    token = 'C+EeFc/1G1r9Z1NBL+9uVVf+0Q+02xc1T9eDsEkHyNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048