UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8TPgeKNX3mMKa0V3Je0tJ/x2mVmTS2k0UPUFD5cQkWM=' 
WHERE 
  key_id = '5a5959a6e34719fa2eba18fb8dc3831d944ef4c87f8918ce9e7e57d4c19961df' 
  AND (
    token = '8TPgeKNX3mMKa0V3Je0tJ/x2mVmTS2k0UPUFD5cQkWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040