UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfSj1h2USPNYq17THhw15saYhI6nTGql03Zg+5dv1Jo=' 
WHERE 
  key_id = '9a87688e84dcef19ad5fd0a0880da39e0d9c511e4940bb1edbd45d66ab495d2a' 
  AND (
    token = 'BfSj1h2USPNYq17THhw15saYhI6nTGql03Zg+5dv1Jo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042