UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I0bAHX8sbS5ZL7eG04cCk1b8Oet28WPfj6h5wCMwZvs=' 
WHERE 
  key_id = 'ed5e6a3db9caf85460816a90934d33450e3a3f9d2189e5f2f3aea258d63de87d' 
  AND (
    token = 'I0bAHX8sbS5ZL7eG04cCk1b8Oet28WPfj6h5wCMwZvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041