UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FAyP1a6Um31WZEMw8IEbS/souL+sWchZ3Muc7/nazGI=' 
WHERE 
  key_id = '6bafed2fb126b4fe80e69b2be957bf5ec81797e2cb27fac160f5aff0e22985be' 
  AND (
    token = 'FAyP1a6Um31WZEMw8IEbS/souL+sWchZ3Muc7/nazGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028