UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lee97S1QZaJb1OvAJJ/BMxP7DdvAOSJ6xk64vzf2L0s=' 
WHERE 
  key_id = '13f2d832486e16f26be7a9df5868691ae54f402c011df604e38f938cab8af3cd' 
  AND (
    token = 'lee97S1QZaJb1OvAJJ/BMxP7DdvAOSJ6xk64vzf2L0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032