UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r06TgPTmC/fcBBESvSrftlqYfXAFhVRpouLnLZLOeiI=' 
WHERE 
  key_id = '0e986399783e9ae0137e2a7ceb3d8bf5e02fa6b5d70466662011e2ca88b10acb' 
  AND (
    token = 'r06TgPTmC/fcBBESvSrftlqYfXAFhVRpouLnLZLOeiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045