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

Query time 0.00020