UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7BSOgsKYCHoPDt0ZsKteHgRWC1hOZhLHev6Z/QURd+Y=' 
WHERE 
  key_id = 'b1bf88436f0b39e1c52fbf0116d41aad8016d82b284fc1d26ee81ea8753d9c5b' 
  AND (
    token = '7BSOgsKYCHoPDt0ZsKteHgRWC1hOZhLHev6Z/QURd+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036