UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bz4d0ijyOlwbartsV9Qmq/Vvn78KAZM85ASuflOJ3u4=' 
WHERE 
  key_id = '822d0becd1d07011abaccf2c17b7e0a8014c1a9ba471357c143edf7be506953b' 
  AND (
    token = 'bz4d0ijyOlwbartsV9Qmq/Vvn78KAZM85ASuflOJ3u4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054