UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iaCEzhX4zPm+UmgLZ65u5A75+LXrp1GNOPywL+dzqhM=' 
WHERE 
  key_id = 'acaef5dc1e0b5ba554e3dfa5e0ee4058f062ea1519d2ba1541df277d4e13c316' 
  AND (
    token = 'iaCEzhX4zPm+UmgLZ65u5A75+LXrp1GNOPywL+dzqhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048