UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PCyxHkaeI2Q40AuVR9R/W7XlONTgV4H4MtgbJhR03+I=' 
WHERE 
  key_id = '1ca97d406327cc5521109be3b73deedc3ca5f9f83a8c1f37eeed23770445525e' 
  AND (
    token = 'PCyxHkaeI2Q40AuVR9R/W7XlONTgV4H4MtgbJhR03+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027