UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XqBL0iZrsYApAXu3dnjAak4m5LnlA72wkdYk6H3j0mM=' 
WHERE 
  key_id = '1c6ab2e3cc5c91cd5d8f14a2db637d23089d2d13fc334d94910c50d710eb544f' 
  AND (
    token = 'XqBL0iZrsYApAXu3dnjAak4m5LnlA72wkdYk6H3j0mM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047