UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EV7TUhvGiwNH68toLw0e282BU7Artds2h/ti4AadTBs=' 
WHERE 
  key_id = '34f13f1e0ea3697502a01fcaec771a798eb3841b5d64477a482f57a084865b45' 
  AND (
    token = 'EV7TUhvGiwNH68toLw0e282BU7Artds2h/ti4AadTBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026