UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ar7+DoNdCN0ossFhAkzC43ct4dzRPnT0kzRggpXVlIM=' 
WHERE 
  key_id = 'a5e52e1b780791fe0ded273b440d1f5d2ce035cccbeed1ce781a01d9c26c844a' 
  AND (
    token = 'ar7+DoNdCN0ossFhAkzC43ct4dzRPnT0kzRggpXVlIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046