UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gaoqPbvJurnR/vsQ6tnL+pit4lNpXs4v3XxyYvH5ZMc=' 
WHERE 
  key_id = 'ca08857ee1e773068acce15a16c11a5c0176795241f1d7dbd08db0d802762bd9' 
  AND (
    token = 'gaoqPbvJurnR/vsQ6tnL+pit4lNpXs4v3XxyYvH5ZMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030