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

Query time 0.00026