UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SsNl3LA5Tunpt5keCsshQGoTrjKN0ZuzKrBrIQIbyJ0=' 
WHERE 
  key_id = '0971a6ff0acb21d6402d1b3c9185e5c65b5a8863406d628877dd2d6d00ada74e' 
  AND (
    token = 'SsNl3LA5Tunpt5keCsshQGoTrjKN0ZuzKrBrIQIbyJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039