UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsGnkLLCmfGy4NK9hRq86Fzseak7ktZp3z/mRzTliwQ=' 
WHERE 
  key_id = '5da2cf96aa46636e8e17656e4499c395fed348bbb343ed306f7a98c03bc2ffea' 
  AND (
    token = 'KsGnkLLCmfGy4NK9hRq86Fzseak7ktZp3z/mRzTliwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031